<template>
  <div class="gl_contentBox gl_heightFull">
    <div class="demo-input-suffix gl_searchBox">
      <el-row :gutter="20">
        <el-col :span="4">
          <p>名称</p>
          <el-input v-model="Api_GET_ClubBranchBranchFeeRequestsQO.Filter" placeholder="请输入名称" size="mini" clearable @change="getFeelsit()" />
        </el-col>
        <el-col :span="6">
          <p>提交时间</p>
          <el-date-picker
            v-model="freeDate"
            size="mini"
            style="width: 100%"
            type="daterange"
            range-separator="至"
            start-placeholder="提交开始日期"
            end-placeholder="提交结束日期"
            value-format="yyyy-MM-dd"
            @change="changeAttendance"
          />
        </el-col>
        <el-col :span="4">
          <el-button type="primary" style="margin-top:25px" size="mini" @click="getFeelsit()">筛选</el-button>
          <el-button type="warning" size="mini" @click="reset()">{{ $t('button.Reset') }}</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="gl_mt_15">
      <el-table v-loading="tableLoading" class="gl_table_noBorder" size="mini" :data="tableData">
        <el-table-column type="index" label="序号" width="55" />
        <el-table-column label="名称" prop="name" width="180" />
        <el-table-column label="提交时间" align="center">
          <template slot-scope="{ row }">
            <span v-if="row.creationTime">
              {{ row.creationTime | FormatDate('yyyy-MM-dd HH:mm:ss') }}
            </span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="160">
          <template slot-scope="{row}">
            <el-button size="mini" type="text" @click="topersonal(row)">查看名单</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <el-row class="gl_pt_15" style="text-align: right;">
      <el-pagination
        :current-page="Api_GET_ClubBranchBranchFeeRequestsQO.Page"
        :page-size="Api_GET_ClubBranchBranchFeeRequestsQO.MaxResultCount"
        :total="totalPage"
        layout="total,sizes,prev,pager,next,jumper"
        :page-sizes="[10, 20, 30, 40]"
        @size-change="sizeChange"
        @current-change="pageIndexChange"
      />
    </el-row>
  </div>
</template>

<script>
import { api_GET_ClubBranchBranchFeeRequests } from '@/extend/api/hallswaggerApi/app.js';
import { Api_GET_ClubBranchBranchFeeRequestsQO } from '@/lib/form/hall/swaggerForm';
export default {
  data() {
    return {
      totalPage: 0,
      tableData: [{}],
      tableLoading: false,
      IsEnabled: '',
      freeDate: [],
      Api_GET_ClubBranchBranchFeeRequestsQO: new Api_GET_ClubBranchBranchFeeRequestsQO() // 缴费名单
    };
  },
  created() {
    // this.getFeelsit();
  },
  methods: {
    // 获取缴费名单
    getFeelsit(page) {
      this.tableLoading = true;
      this.Api_GET_ClubBranchBranchFeeRequestsQO.OrganizationUnitId = this.$route.query.branchid; // type: string
      this.Api_GET_ClubBranchBranchFeeRequestsQO.Page = page || 1;
      this.Api_GET_ClubBranchBranchFeeRequestsQO.SkipCount = (this.Api_GET_ClubBranchBranchFeeRequestsQO.Page - 1) * this.Api_GET_ClubBranchBranchFeeRequestsQO.MaxResultCount;
      api_GET_ClubBranchBranchFeeRequests(this.Api_GET_ClubBranchBranchFeeRequestsQO).then(res => {
        this.tableLoading = false;
        this.tableData = res.items;
        this.totalPage = res.totalCount;
      }, error => {
        this.tableLoading = false;
        const _msg = error.error.message || error.message;
        this.$message({ type: 'error', message: _msg });
      });
    },
    topersonal(row) {
      this.$router.push({ name: 'Lookmember', query: { branchid: this.$route.query.branchid, id: row.id }});
    },
    // 切换提交日期
    changeAttendance (val) {
      const _start = val ? val[0] : null;
      const _end = val ? val[1] : null;
      this.Api_GET_ClubBranchBranchFeeRequestsQO.MinCreationTime = _start;
      this.Api_GET_ClubBranchBranchFeeRequestsQO.MaxCreationTime = _end;
      this.getFeelsit();
    },
    // 分页按钮
    sizeChange(MaxResultCount) {
      this.Api_GET_ClubBranchBranchFeeRequestsQO.MaxResultCount = MaxResultCount;
      this.getFeelsit();
    },
    pageIndexChange(currentPage) {
      this.getFeelsit(currentPage);
    },
    // 重置按钮
    reset () {
      this.Api_GET_ClubBranchBranchFeeRequestsQO = new Api_GET_ClubBranchBranchFeeRequestsQO();
      this.freeDate = [];
      this.getFeelsit();
    }
  }
};
</script>

<style>

</style>
